import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/rank/rank_user_icon.dart';
import 'package:flutter_eve_plugin/constants/font_family.dart';
import 'package:flutter_eve_plugin/constants/font_weight.dart';
import 'package:flutter_eve_plugin/model/ye_xiu/rank/rank_info.dart';
import 'package:flutter_eve_plugin/utils/color_common.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';

class RankItemWidget extends StatelessWidget {
  final RankUser rankUser;
  final int index;

  const RankItemWidget({Key key, this.rankUser, this.index}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.transparent,
      height: setRatio(60),
      child: Row(
        children: <Widget>[
          SizedBox(
              width: setRatio(43),
              child: Center(
                child: Text(
                  '${index.toString()}',
                  style: TextStyle(
                      fontFamily: FontFamily.PINGFANG,
                      fontWeight: FontWeightCustom.PF_Medium,
                      fontSize: setTextSp(13),
                      color: Color(ColorRes.colorEFF5FD)),
                ),
              )),
          RankUserIcon(
            iconUrl: rankUser.avatarUrl,
            level: rankUser.rank,
            height: 40,
            width: 40,
          ),
          SizedBox(
            width: setRatio(12),
          ),
          Text(
            rankUser.nickname,
            style: TextStyle(
                fontFamily: FontFamily.PINGFANG,
                fontWeight: FontWeightCustom.PF_Medium,
                fontSize: setRatio(14),
                color: Color(ColorRes.colorEFF5FD)),
          ),
          SizedBox(
            width: setRatio(5),
          ),
          Offstage(
              offstage: !rankUser.isVip,
              child: Image.asset(
                imageUtilYeXiu('checkpoint/icon_checkpoint_vip@3x'),
                width: setRatio(35),
                height: setRatio(25),
              )),
          Expanded(
              child: Text(
            rankUser.pValue.toString(),
            textAlign: TextAlign.right,
            style: TextStyle(
                fontFamily: FontFamily.PINGFANG,
                fontWeight: FontWeightCustom.PF_Medium,
                color: Color(ColorRes.colorF6F5E4),
                fontSize: setTextSp(13)),
          )),
          SizedBox(
            width: setRatio(20),
          )
        ],
      ),
    );
  }
}
